import useUserStore from '@/store/user.ts'
import {Decrypt, Encrypt} from '@/utils/crypto.ts'

// 根据角色获取按钮权限
export const getRoleBtn = (code: string) => {
	const userStore = useUserStore()
	if (!code) {
		return true
	}
	const list = userStore.getPermissions
	return !!list.find(item => item === code) || list[0] === '*:*:*'
}

/**--- 存储序列化加密start --*/
const key = 'b006e82bc5982e245a51af6b4f3140bf'
const iv = '578aa9ef6c589d9ed24104bf3668a58a'
export const storeStringify = (value: any) => {
	return Encrypt(value, key, iv)
}
export const storeParse = (value: any) => {
	return Decrypt(value, key, iv)
}
/**--- 存储序列化加密end --*/
